<!doctype html>
<html>
  <head>
    <title>Notification permission helper</title>
  </head>
  <body>
    <script>
      Promise.all([
        Notification.requestPermission(),
        navigator.permissions.query({ name: 'notifications' }),
        navigator.permissions.query({ name: 'push', userVisibleOnly: true }),
      ]).then(results => {
        parent.postMessage({
          notificationPermission: Notification.permission,
          notificationRequestPermission: results[0],
          permissionApiNotificationPermission: results[1].state,
          permissionApiPushPermission: results[2].state
        }, '*' /* all origins */);
      });
    </script>
  </body>
</html>
